lib/repo-commit: Abort a transaction if preparing it fails
authorPhilip Withnall <withnall@endlessm.com>
Tue, 26 Jun 2018 13:39:16 +0000 (14:39 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 29 Jun 2018 19:32:44 +0000 (19:32 +0000)
commitabff8b8cfac00203062362ad506ffdb14f1da6ef
treecf1d0713b56fcbc5efee1e9d1da4156dce4b7c1f
parentbe018ed70cf08a4bc0fb6b1885b4965e729b6d5c
lib/repo-commit: Abort a transaction if preparing it fails

If ostree_repo_prepare_transaction() fails, we should reset the
repository’s state so that the failed call was essentially idempotent.
Do that by calling ostree_repo_abort_transaction() on the failure path.

Typically, the way for preparing a transaction to fail is for its
GCancellable to be triggered, rather than because any of the operations
involved in preparing a transaction are particularly failure prone.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1647
Approved by: cgwalters
src/libostree/ostree-repo-commit.c